package fr.web325.servlet.api.user;

import fr.web325.bean.Json;
import net.sf.json.JSONObject;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.*;
import java.io.IOException;

@WebServlet("/api/loginOut")
public class LoginOut extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        HttpSession session = req.getSession();
        // 清空自动登录的cookie
        session.removeAttribute("user");
        resp.getWriter().print(new Json(205,null,"已退出").getRespJson());
    }
}
